package org.sjm.samples.dao;

import java.util.List;

import org.sjm.samples.model.ExamUserRole;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

@Repository
@Transactional
public class ExamUserRoleDAOImpl extends BaseHibernateDAO<ExamUserRole> implements IExamUserRoleDAO {

	@Override
	public List<ExamUserRole> findAllExamUserRoles() {
		return this.find("FROM ExamUserRole");
	}

	@Override
	public ExamUserRole getExamUserRoleByUserId(String id) {
		return this.queryForObject("FROM ExamUserRole AS r WHERE r.user.userId=? ", new Object[]{id});
	}

	@Override
	public void saveExamUserRoles(List<ExamUserRole> examUserRoleList) {
		this.save(examUserRoleList);
	}
}
